package com.jackykeke.fiveplussdkdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.jackykeke.HBuilder.integrate.SDK_WebApp;
import com.jackykeke.utils.PermissionUtils;

public class ButtonActivity extends AppCompatActivity {

    private Button button;
    private Button button2;
    private EditText edittext;
    private Button button3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_button);

        PermissionUtils.requestMultiPermissions(this);

        button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(ButtonActivity.this, ScanActivity.class);
                intent.putExtra("mode", 1);
                startActivity(intent);

            }
        });

        button2=(Button) findViewById(R.id.button2);

        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ButtonActivity.this, ScanActivity.class);
                intent.putExtra("mode", 2);
                startActivity(intent);
            }
        });

        edittext=(EditText) findViewById(R.id.edittext);

        button3=(Button) findViewById(R.id.button3);

        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                edittext.getText().toString();
                Intent intent = new Intent(ButtonActivity.this, SDK_WebApp.class);
                intent.putExtra("web",  edittext.getText().toString());
                intent.putExtra("mode", 2);
                startActivity(intent);
            }
        });
    }
}
